package com.wzh.mall.product.web;

import com.wzh.mall.product.service.SkuInfoService;
import com.wzh.mall.product.vo.SkuItemVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.concurrent.ExecutionException;

/**
 * @program: mall
 * @description: 商品详情信息
 * @author: Mr.Wang
 * @create: 2021-09-13 08:48
 **/
@Controller
public class ItemController {

    @Autowired
    SkuInfoService skuInfoService;


    /**
      * @Description: 展示当前sku的详情
      * @Param: [skuId]
      * @return: java.lang.String
      * @Author: Mr.Wang
      * @Date: 2021/9/13
      * @Time: 8:49
      */      
      
    @GetMapping("/{skuId}.html")
    public String skuItem(@PathVariable Long skuId, Model model) throws ExecutionException, InterruptedException {
        System.out.println("准备查询"+skuId+"的详情");
        SkuItemVo vo=skuInfoService.item(skuId);

        model.addAttribute("item",vo);
        return "item";
    }
}
